<?
// this script connects to DB and adds new clicks when onClick is pressed

$creative_id = $_GET['creative_id'];
$tag_array = $_GET['tags'];
$referring_url = $_GET['referring_url'];


 //transform $tag_ids string into an array


    $link = mysql_connect('localhost', 'root', 'root');
    if (!$link)
    {
        die('Could not connect: ' . mysql_error());
    }
    echo 'Connected successfully';
    mysql_select_db("creativetracker") or die(mysql_error());
    mysql_query("INSERT INTO clicks (creative_id,tag_ids,referring_url,timestamp) VALUES ('$creative_id', '$tag_array','$referring_url', ".mktime()." ) ")
            or die(mysql_error());

    mysql_close($link);

?>
